package com.woniu.user.mapper;

import com.woniu.user.pojo.UserCircle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 我的车圈表 Mapper 接口
 * </p>
 *
 * @author LiFangyu
 * @since 2023-02-15
 */
public interface UserCircleMapper extends BaseMapper<UserCircle> {

    @Select("select * from t_user_circle where user_id = #{id} and car_circle_id = #{circleId}")
    UserCircle selectIsLikeCircle(@Param("id") String id, @Param("circleId") String circleId);

    @Update("UPDATE t_user_circle SET is_deleted = 0 WHERE user_id = #{id} and car_circle_id = #{circleId} AND is_deleted = 1")
    int updateIsDeleted(@Param("id") String id, @Param("circleId") String circleId);

    @Update("UPDATE t_user_circle SET is_deleted = 1 WHERE user_id = #{id} and car_circle_id = #{circleId} AND is_deleted = 0")
    int rmLikeCircle(@Param("id") String id, @Param("circleId") String circleId);
}
